// import request from '@/utils/request'
import axios from 'axios'
const request = axios.create({
    baseURL: 'http://122.51.249.55:7001',
})
request.interceptors.request.use(config => {
        // 如果登录了就要携带token
        config.headers.Authorization = 'Bearer ' + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjIsImlhdCI6MTY0NjYxNTkxOCwiZXhwIjoxNjc3NzE5OTE4fQ.thBEM6pwaSJLio9SeaX3Jr61ZqWiVbfhnNVoXEVAKd0'
        return config
    }, error => {
        return Promise.reject(error)
    })
    // 学科简单列表
export function subjectsSimpleList() {
    return request({
        url: '/subjects/simple',
        method: 'GET',
    })
}
// 精选题库列表
export function choiceListData(params) {
    return request({
        url: '/questions/choice',
        method: 'GET',
        params

    })
}
// 预览接口
export function detailListData(id) {
    return request({
        url: `/questions/${id}?id=${id}`,
        method: 'GET',

    })
}
// 精选题库审核
export function AuditSuggest(data) {
    return request({
        url: `/questions/check/${data.id}`,
        method: 'post',
        data

    })
}
// 获取二级目录directory
export function directoryListData(id) {
    return request({
        url: `/directorys/simple?subjectID=${id}`,
    })
}
// 获取标签
export function tagsListData(id) {
    return request({
        url: `/tags/simple?subjectID=${id}`,
    })
}
// 搜索
export function searchList(params) {
    return request({
        url: '/questions/choice?',
        params
    })
}
//  上下架
export function putAway(data) {
    return request({
        url: `/questions/choice/${data.id}/${data.publishState}`,
        method: 'POST',
        data
    })
}
// 删除questions/22
export function delList(id) {
    return request({
        url: `questions/${id}`,
        method: 'DELETE',

    })
}